window.onload = function () {
    windowAddMouseWheel();
    var item = 1;
    var num = 0;    // 统计滑轮滑动了几次，以为滑动速度过快，直接就到底了，这样中间的就不会显示了，当滑动了10次
    function windowAddMouseWheel() {
        var scrollFunc = function (e) {
            e = e || window.event;
            if (e.wheelDelta) {  //判断浏览器IE，谷歌滑轮事件
                if (e.wheelDelta < 0) { //当滑轮向上滚动时
                    num ++;
                }
                if (e.wheelDelta > 0) { //当滑轮向下滚动时
                    num --;
                }
                console.log("num"+num);
                if(num > 1){
                    $('.bili_head').setAttribute('style','background:rgb(255, 255, 255); color:black;');
                    for(var i = 2; i <= 14; i++){
                        var color = "."+"color" + i;
                        $(color).style.color="black";
                    }
                }else{
                    $('.bili_head').setAttribute('style','background:linear-gradient(rgba(0, 0, 0, 0.6), rgba(255, 255, 255, 0));color:white;');
                    // $('.bili_head a').style.color="white";
                    for(var i = 2; i <= 14; i++){
                        var color = "."+"color" + i;
                        $(color).style.color="white";
                    }
                }
                if(num < 0){
                    num = 0;
                }
                if(num > 60){
                    num = 60;
                }
            }
        };
        //给页面绑定滑轮滚动事件
        if (document.addEventListener) {
            document.addEventListener('DOMMouseScroll', scrollFunc, false);
        }
        //滚动滑轮触发scrollFunc方法
        window.onmousewheel = document.onmousewheel = scrollFunc;
    }

    function $(param) {
        if (arguments[1] == true) {
            return document.querySelectorAll(param);
        } else {
            return document.querySelector(param);
        }
    }

    function ani() {
        $(".popOut").className = "popOut ani";
    }
    function regist_ani() {
        $(".regist_popOut").className = "regist_popOut ani";
    }
    //登录弹窗
    $("button").onclick = function () {
        $(".bili_head").style.display = "none";
        $(".row1_background").style.display = "none";
        $(".popOut").style.display = "block";
        ani();
        $(".popOutBg").style.display = "block";
    };
    $(".popOut > span").onclick = function () {
        $(".bili_head").style.display = "flex";
        $(".row1_background").style.display = "block";
        $(".popOut").style.display = "none";
        $(".popOutBg").style.display = "none";
    };
    $(".popOutBg").onclick = function () {

        $(".bili_head").style.display = "flex";
        $(".row1_background").style.display = "block";
        $(".popOut").style.display = "none";
        $(".regist_popOut").style.display = "none";
        $(".popOutBg").style.display = "none";
    };

    //注册弹窗

    $(".bili_regist1").onclick = function () {
        $(".bili_head").style.display = "none";
        $(".row1_background").style.display = "none";
        $(".popOut").style.display = "none";
        $(".regist_popOut").style.display = "block";
        regist_ani();
        $(".popOutBg").style.display = "block";
    };
    $(".bili_regist").onclick = function () {
        $(".bili_head").style.display = "none";
        $(".row1_background").style.display = "none";
        $(".regist_popOut").style.display = "block";
        regist_ani();
        $(".popOutBg").style.display = "block";
    };

    $(".regist_popOut > span").onclick = function () {
        $(".bili_head").style.display = "flex";
        $(".row1_background").style.display = "block";
        $(".regist_popOut").style.display = "none";
        $(".popOutBg").style.display = "none";
    };


    var login = document.querySelector(".bili_login");
    var hidden = document.querySelector(".hidden_login");

    login.onmousemove = function () {

        hidden.style.display = "flex";
    };
    login.onmouseout = function () {
        setTimeout(f, 1000);
    };
    function a(e){
        if(e==""){
            //未登录
        }else{
            //扽登录
        }
    }
    function f() {
        if (hidden.onmousemove === undefined) {
            hidden.style.display = "none";
        }
        hidden.onmousemove = function () {
            console.log(hidden.onmousemove);
            hidden.style.display = "flex";
        };
    }

    hidden.onmouseout = function () {
        hidden.style.display = "none";
    }

  /*  var tlogin = document.querySelector(".tbili_login");
   var thidden = document.querySelector(".thidden_login");

   tlogin.onmousemove = function () {

       thidden.style.display ="flex";
   };
   tlogin.onmouseout = function () {
       setTimeout(f1, 1000);
   };

   function f1() {
       if (thidden.onmousemove === undefined) {
           thidden.style.display = "none";
       }
       thidden.onmousemove = function () {
           console.log(thidden.onmousemove);
           thidden.style.display = "flex";
       };
   }

   thidden.onmouseout = function () {
       thidden.style.display = "none";
   }*/
}